package 构造方法;

import java.util.Date;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: lenovo
 * Date: 2022-06-22
 * Time: 16:11
 */
class Data{
    //成员变量
    public int year;
    public int month;
    public int day;
    //构造方法
    //带三个参数的构造方法
    public Data(int year, int month, int day) {
        this.year = year;
        this.month = month;
        this.day = day;
    }
//带两个参数的构造方法
    public Data(int year, int month) {
        this.year = year;
        this.month = month;
    }

    //带一个参数的构造方法
    public Data(int year) {
        this.year = year;
    }
    //不带参数的构造方法
    public Data() {
    }
    //成员方法
    public void printDay(){
        System.out.println(year+"/"+month+"/"+day);
    }
}
public class Test {
    public static void main(String[] args) {
        Data date1 = new Data(2022,6,22);
        date1.printDay();
    }
}
